//  双指针
var twoSum = function (nums, target) {
  let i = 0; 
  let j = nums.length - 1;
  while (i < j) {
    let sum = nums[i] + nums[j];
    if (sum > target) {
      j--;
    } else if (sum < target) {
      i++;
    } else {
      return [nums[i], nums[j]];
    }
  }
}